import App from './App'
import store from './store'

// #ifndef VUE3
import Vue from 'vue'
import publicFn from './common/js/public.js'
// import staticIconPath from './common/js/icon.js'
import utils from './utils/utils.js'
import Cache from './utils/Cache.js'
import {
	// fetch,
	request,
	baseUrl,
	imgDomain
} from './request/index.js'
import api from './common/js/api';

// console.log(111,staticIconPath());

const rules = {
	"int": /^-?\d+$/,
	"age": /^\d+$/,
	"minusint": /^-\d+$/,
	"plusint": /^\d+$/,
	"num": /^(-?\d+)(\.\d+)?$/,
	"price": /^\d+(\.\d+)?$/,
	"minusnum": /^-(\d+)(\.\d+)$/,
	"phone": /^\s*\+?\s*(\(\s*\d+\s*\)|\d+)(\s*-?\s*(\(\s*\d+\s*\)|\s*\d+\s*))*\s*$/,
	// /^1[3|4|5|8][0-9]\d{4,8}$/
	"mobile": /^1[3456789]\d{9}$/,
	"email": /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,
	"yyyy-MM-dd": /^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))$/,
	"password": /^[\w\W]{6,16}$/,
	"idcard": /^(\d{15}$)|(^\d{17}([0-9]|X)$)/,
	"carnumber": /^[\u4E00-\u9FA5][\da-zA-Z]{6}$/
}
Vue.prototype.$common = publicFn;
// Vue.prototype.$staticIcon = staticIconPath;
Vue.prototype.$utils = utils;
Vue.prototype.$store = store;
Vue.prototype.$Cache = Cache;
Vue.prototype.$api = api;
Vue.prototype.$rules = rules;
Vue.prototype.$DoMain = baseUrl;

//与$common.imgUrl()方法都可以实现图片域名拼接，两种方式都可行。
Vue.prototype.$imgDomain = (url) =>{
	return (imgDomain + url);
} ;
Vue.prototype.$http = request;
Vue.config.productionTip = false;
App.mpType = 'app'
const app = new Vue({
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif
